#ifndef CDUNGEONFLOOR_H_INCLUDED
#define CDUNGEONFLOOR_H_INCLUDED

#include <fstream>
#include <string>
#include <vector>

#include <libtcod/libtcod.hpp>

#include "Utils.h"
#include "CDungeonTile.h"
#include "CEntity.h"
#include "CItem.h"
#include "CTurnSchedule.h"

class CDungeonFloor
{
public:
    ~CDungeonFloor();

    bool isTile(pair position);
	bool visitNode(TCODBsp* node, void* userData);

	CDungeonTile* getTile(pair position);
    CEntity* getEntityAt(pair position);
    TCODMap* getFovMap();

	pair getSize();

	void generate(int thisFloor, pair size, CDungeonFloor* floorAbove);
	void saveDungeonToFile(std::string fileName);
	void update();

	std::vector<CEntity*> Entities;
	std::vector<CItem*> Items;

private:
    int MinRoomSize;
	int UpStairs;

	TCODMap* FovMap;

	pair Size;
	std::vector<std::vector<CDungeonTile> > FloorTiles;

	void GenerateCellularAutomata(unsigned int iterations, unsigned int percentWalls);
};

#endif
